#include <cstring>
#include <iostream>

using namespace std;

int convert(string s, int start, int length)
{
    int ans = 0;
    for (int i = start; i <= length; ++i)
    {
        ans = ans * 10 + (s[i] - 48);
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    string s;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        int a = convert(s, 0, s.size() - 1);
        int b = convert(s, 0, (s.size() - 1) / 2);
        int c = convert(s, (s.size() - 1) / 2 + 1, s.size() - 1);
        if(c == 0)
        {
            cout << "No" << endl;
            continue;
        }
        if (a % (b * c) == 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}